<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<link href="__STATIC__/imgsrc/designer.css" rel="stylesheet">
	<style>
	.hyk-silider::-webkit-scrollbar {width: 0px;height: 0px;}
	.hyk-silider::-webkit-scrollbar-thumb {border-radius: 0px;-webkit-box-shadow: inset 0 0 0px rgba(0,0,0,0.1);background: rgba(0,0,0,0.2);}
	.hyk-silider::-webkit-scrollbar-track {-webkit-box-shadow: inset 0 0 0px rgba(0,0,0,0.5);border-radius: 0;background: rgba(0,0,0,0);}
	.hyk-silider a{ text-decoration:none; }

	.hyk-silider *{ font-family:"微软雅黑"; font-size:14px; }
	.hyk-top{ width:100%; background:#fff; float:left; padding:20px 0px 10px 0; }
	.hyk-box{ width:300px; height:160px; background:#63b359 no-repeat center; background-size:300px 160px; border-radius:8px; margin:0 auto; position:relative; }
	.hyk-logo{ width:50px; margin:20px 10px 0px 10px; float:left; height:50px; border-radius:50%; }
	.hyk-sp1{ position:absolute; left:70px; right:10px; top:20px; color:#fff; font-size:18px; height:25px; line-height:25px; overflow:hidden; }
	.hyk-sp2{ position:absolute; left:70px; right:10px; top:45px; color:#fff; font-size:14px; height:25px; line-height:25px; overflow:hidden; }
	.hyk-sp3{ position:absolute; left:15px; right:10px; bottom:15px; color:#fff; font-size:14px; height:25px; line-height:25px; overflow:hidden; }
	.hyk-ul{ width:100%; float:left; padding:0px; margin:0px; list-style:none; }
	.hyk-ul li{ width:33.3%; float:left; margin-top:15px; list-style:none; }
	.hyk-ul li.hyk-li{ box-sizing:border-box; border-left:1px #f2f2f2 solid; border-right:1px #f2f2f2 solid; }
	.hyk-lisp1{ display:block; width:100%; text-align:center; height:25px; line-height:25px; overflow:hidden; color:#565656; font-weight:600; }
	.hyk-lisp2{ display:block; width:100%; text-align:center; height:30px; line-height:30px; overflow:hidden; color:#55bc47; font-size:18px; }
	.hyk-btn{ width:30%; margin:0 35%; float:left; border:1px #55bc47 solid; color:#55bc47; margin-top:20px; height:38px; line-height:38px; border-radius:5px; background:#fff; font-size:16px;  } 
	.hyk-tle{ width:100%; height:30px; line-height:30px; margin-top:5px; color:#8a8a8a; text-align:center; float:left; }
	
	.layui-form-label{width:130px !important;}
	.layui-input-inline{width:300px !important;}

	#custom_field_preview{width: 100%;background: #fff;margin-top:10px;padding:0 10px;font-size:15px;margin-bottom:10px;float:left;display:flex}
	#custom_field_preview .item{display:flex;flex-direction:column;flex:1;align-items:center;border-right:1px solid #f8f8f8}
	#custom_field_preview .item:last-child{border-right:0}
	#custom_field_preview .t1{color:#565656; font-weight:600;}
	#custom_field_preview .t2{color:#55bc47; font-size:16px;}

	.custom_cell{ width: 94%;background: #fff;margin:10px 3%;padding:0;font-size:15px;float:left;border-top: 1px solid #eee;}
	.custom_cell .item{ height:50px;display:flex;align-items:center;border-bottom:1px solid #eee}
	/*.custom_cell .item:first-child{border-top:1px solid #eee;margin-bottom:0.1rem}*/
	.custom_cell .f2{font-size:15px; font-weight:600;color:#333;}
	.custom_cell .f3{ color: #666;text-align:right;flex:1;}
	.custom_cell .f4{ width: 20px; height: 20px;}
	</style>
</head>
<body>
<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<div class="layui-card layui-col-md12">
			<div class="layui-card-header"><i class="fa fa-cog"></i> 会员卡设置
				<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
			</div>
			<div class="layui-card-body" pad15>
				<div class="panel-body flex" ng-app="FoxEditor" ng-controller="FoxController">
					<div class="dsn-phone">
						<div class="dsn-phone-left"></div>
						<div class="dsn-phone-center">
							<div class="dsn-phone-top"></div>
							<div class="dsn-phone-main" id="editor">
								<div class="dsn-mod dsn-topbar dsn-mod-nohover" style="height:auto;color:#eee;background:#000">
									<div style="float:left;width:100%;font-size:12px">
										<div style="float:left;width:30%">&nbsp;<i class="fa fa-signal"></i> wechat <i class="fa fa-wifi"></i></div>
										<div style="float:left;text-align:center;width:40%">12:00</div>
										<div style="float:left;text-align:right;width:30%">100% <i class="fa fa-battery-full"></i>&nbsp;</div>
									</div>
								</div>
								<div style="width:100%;height:40px;line-height:40px;text-align:center;color:#000;font-size:15px;font-weight:bold">会员卡</div>
								<div style="width:100%;height:580px;background:#fff;overflow-y:scroll;" class="hyk-silider">
									<div class="hyk-top">
										<div class="hyk-box" bind-data="bg_type" style="background:{if $info['bg_type']==0}{$info.color}{else}url({$info.background_pic_url}){/if}">
											<img src="{if $info['logo_url']}{$info['logo_url']}{else}__STATIC__/images/logo.png{/if}" class="hyk-logo" bind-data="logo_url"/>
											<span class="hyk-sp1" bind-data="brand_name">{$info.brand_name}</span>
											<span class="hyk-sp2" bind-data='title'>{$info.title}</span>
											<span class="hyk-sp3">1234 5678 9000</span>
										</div>
										<div id="custom_field_preview">
											{foreach $info['custom_field'] as $v}
											<div class="item">
												<span class="t1">{if $v=='自定义1'}{$info.custom_field_customize1_name}{elseif $v=='自定义2'}{$info.custom_field_customize2_name}{else}{$v}{/if}</span>
												<span class="t2">{if $v=='积分'}100{elseif $v=='余额' || $v==t('余额')}10.00{elseif $v=='优惠券' || $v==t('优惠券')}2{elseif $v=='等级'}{$defaultlv.name}{elseif $v=='自定义1'}{$info.custom_field_customize1_value}{elseif $v=='自定义2'}{$info.custom_field_customize2_value}{else}查看{/if}</span>
											</div>
											{/foreach}
										</div>
										<div style="{if !$info['center_title']}display:none{/if}" id="center_show">
											<button class="hyk-btn" bind-data='center_title'>{$info.center_title}</button>
											<span class="hyk-tle" bind-data='center_sub_title'>{$info.center_sub_title}</span>
										</div>
									</div>
									<div class="custom_cell">
										<div class="item" style="{if !$info['custom_url_name'] || !$info['custom_url']}display:none{/if}" id="custom_url_show">
											<div class="f2" bind-data="custom_url_name">{$info.custom_url_name}</div>
											<span class="f3" bind-data="custom_url_sub_title">{$info.custom_url_sub_title}</span>
										</div>
										<div class="item" style="{if !$info['custom_cell1_url']}display:none{/if}" id="custom_cell1_show">
											<div class="f2" bind-data="custom_cell1_name">{$info.custom_cell1_name}</div>
											<span class="f3" bind-data="custom_cell1_tips">{$info.custom_cell1_tips}</span>
										</div>
										<div class="item" style="{if !$info['promotion_url_name'] || !$info['promotion_url']}display:none{/if}" id="promotion_url_show">
											<div class="f2" bind-data="promotion_url_name">{$info.promotion_url_name}</div>
											<span class="f3" bind-data="promotion_url_sub_title">{$info.promotion_url_sub_title}</span>
										</div>
										<div class="item">
											<div class="f2">会员卡详情</div>
											<span class="f3"></span>
										</div>
										<div class="item">
											<div class="f2">公众号</div>
											<span class="f3"></span>
										</div>
									</div>
								</div>
							</div>
							<div class="dsn-phone-bottom"></div>
						</div>
						<div class="dsn-phone-right"></div>
					</div>

					<div class="dsn-panel layui-form" lay-filter="form" style="width:700px">
						<div class="dsn-panel-editor" ng-show="focus" style="min-height:680px">
							<div class="dsn-panel-editor-title">会员卡设置</div>
							<div class="dsn-panel-editor-content" style="height:620px">
								<input type="hidden" name="info[id]" value="{$info['id']}"/>
								{if $info['id']}
								<div class="layui-form-item">
									<label class="layui-form-label">卡券ID：</label>
									<div class="layui-form-mid">{$info['card_id']}&nbsp;&nbsp;{if $info['status']==0}审核中{elseif $info['status']==1}审核通过{elseif $info['status']==2}审核不通过 {$info['RefuseReason']}{/if}</div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>商户名称：</label>
									<div class="layui-input-inline" style="width:300px">
										<input type="text" name="info[brand_name]" lay-verify="required" {if $info.status==1}readonly{/if} value="{$info.brand_name}" lay-verType="tips" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>LOGO：</label>
									<input type="hidden" name="info[logo_url]" id="logo_url"  lay-verType="tips" class="layui-input" value="{$info.logo_url}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="logo_url" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：300×300像素</div>
									<!-- <div style="float:left;padding-top:10px;padding-left:180px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info.logo_url}" id="logo_url"/></div></div>
									</div> -->
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>会员卡名称：</label>
									<div class="layui-input-inline" style="width:300px">
										<input type="text" lay-verify="required" class="layui-input" name="info[title]" value="{$info.title}"  lay-verType="tips">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>卡面码型：</label>
									<div class="layui-input-inline" style="width:500px!important">
										<input type="radio" name="info[code_type]" value="CODE_TYPE_TEXT" title="仅显示卡号" {if !$info['id'] || $info['code_type']=='CODE_TYPE_TEXT'}checked{/if}/>
										<input type="radio" name="info[code_type]" value="CODE_TYPE_BARCODE" title="卡号+条形码" {if $info['code_type']=='CODE_TYPE_BARCODE'}checked{/if}/>
										<input type="radio" name="info[code_type]" value="CODE_TYPE_QRCODE" title="卡号+二维码" {if $info['code_type']=='CODE_TYPE_QRCODE'}checked{/if}/>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>封面类型：</label>
									<div class="layui-input-inline">
										<div class="layui-form-item" style="width:500px !important">
											<input type="radio" name="info[bg_type]" value="0" title="颜色" {if $info['bg_type']=='0'}checked{/if} lay-filter="bg_type"/>
											<input type="radio" name="info[bg_type]" value="1" title="图片" {if $info['bg_type']=='1'}checked{/if} lay-filter="bg_type"/>
										</div>
									</div>
								</div>
								<div class="layui-form-item bg_type0" style="{if $info['bg_type']=='1'}display:none{/if}">
									<label class="layui-form-label"><span class="redstar">*</span>选择背景颜色：</label>
									<input type="hidden" name="info[color]" value="{$info.color}">
									<div class="layui-form-mid" style="padding:2px 0 !important">
										<span onclick="selectcolor('#63b359')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#63b359">#63b359</span>
										<span onclick="selectcolor('#2c9f67')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#2c9f67">#2c9f67</span>
										<span onclick="selectcolor('#509fc9')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#509fc9">#509fc9</span>
										<span onclick="selectcolor('#5885cf')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#5885cf">#5885cf</span>
										<span onclick="selectcolor('#9062c0')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#9062c0">#9062c0</span>
										<span onclick="selectcolor('#d09a45')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#d09a45">#d09a45</span>
										<span onclick="selectcolor('#e4b138')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#e4b138">#e4b138</span>
									</div>
									<div class="layui-form-mid" style="padding:2px 0 !important;margin-left:145px">
										<span onclick="selectcolor('#ee903c')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#ee903c">#ee903c</span>
										<span onclick="selectcolor('#f08500')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#f08500">#f08500</span>
										<span onclick="selectcolor('#a9d92d')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#a9d92d">#a9d92d</span>
										<span onclick="selectcolor('#dd6549')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#dd6549">#dd6549</span>
										<span onclick="selectcolor('#cc463d')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#cc463d">#cc463d</span>
										<span onclick="selectcolor('#cf3e36')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#cf3e36">#cf3e36</span>
										<span onclick="selectcolor('#5e6671')" style="cursor:pointer;display:inline-block;width:65px;height:40px;line-height:40px;text-align:center;color:#fff;background:#5e6671">#5e6671</span>
									</div>
								</div>
								<div class="layui-form-item bg_type1" style="{if $info['bg_type']=='0'}display:none{/if}">
									<label class="layui-form-label"><span class="redstar">*</span>自定义背景图：</label>
									<input type="hidden" name="info[background_pic_url]" id="background_pic_url" class="layui-input" value="{$info.background_pic_url}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="background_pic_url" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：750×450像素</div>
									<!-- <div style="float:left;padding-top:10px;padding-left:180px;clear: both;">
										<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img id="background_pic_src" src="{$info.background_pic_url}"/></div></div>
									</div> -->
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">会员信息类目：</label>
									<div class="layui-input-block">
										<input type="checkbox" lay-skin="primary" lay-filter="custom_field" name="info[custom_field][]" value="积分" title="积分" {if in_array('积分',$info['custom_field'])}checked{/if}>
									</div>
									<div class="layui-input-inline" id="custom_cell_sortable" style="width:100px !important">
										{foreach $info['custom_field'] as $k=>$v}
										{if $v!='积分'}
										<div><input type="checkbox" lay-skin="primary" lay-filter="custom_field" name="info[custom_field][]" value="{$v}" title="{$v}" checked></div>
										{/if}
										{/foreach}
										{foreach [t('余额'),'等级',t('优惠券'),'自定义1','自定义2'] as $k=>$v}
										{if !in_array($v,$info['custom_field'])}
										<div><input type="checkbox" lay-skin="primary" lay-filter="custom_field" name="info[custom_field][]" value="{$v}" title="{$v}"></div>
										{/if}
										{/foreach}
									</div>
									<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:150px">拖拽进行排序，注意：最多可选择三个，积分只能放在第一栏</div>
								</div>
								<div id="custom_field_customize1_set" style="{if !in_array('自定义1',$info['custom_field'])}display:none{/if}">
									<div class="layui-form-item" style="margin-bottom:3px">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义1名称</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize1_name]" class="layui-input" value="{$info.custom_field_customize1_name}">
										</div>
									</div>
									<div class="layui-form-item" style="margin-bottom:3px">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义1内容</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize1_value]" class="layui-input" value="{$info.custom_field_customize1_value}">
										</div>
									</div>
									<div class="layui-form-item" style="margin-bottom:3px">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义1链接</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize1_link]" class="layui-input" value="{$info.custom_field_customize1_link}">
										</div>
										<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[custom_field_customize1_link]')" style="float:left">选择链接</button>
									</div>
								</div>
								<div id="custom_field_customize2_set" style="{if !in_array('自定义2',$info['custom_field'])}display:none{/if}">
									<div class="layui-form-item" style="margin-bottom:3px">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义2名称</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize2_name]" class="layui-input" value="{$info.custom_field_customize2_name}">
										</div>
									</div>
									<div class="layui-form-item" style="margin-bottom:3px">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义2内容</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize2_value]" class="layui-input" value="{$info.custom_field_customize2_value}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">自定义2链接</div>
										<div class="layui-input-inline">
											<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_field_customize2_link]" class="layui-input" value="{$info.custom_field_customize2_link}">
										</div>
										<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[custom_field_customize2_link]')" style="float:left">选择链接</button>
									</div>
								</div>
								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label">中部入口：</label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">名 称</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[center_title]" class="layui-input" value="{$info.center_title}">
									</div>
								</div>
								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">备 注</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[center_sub_title]" class="layui-input" value="{$info.center_sub_title}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">链 接</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[center_url]" class="layui-input" value="{$info.center_url}">
									</div>
									<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[center_url]')" style="float:left">选择链接</button>
								</div>

								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label">自定义入口一：</label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">名 称</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_url_name]" class="layui-input" value="{$info.custom_url_name}">
									</div>
								</div>
								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">备 注</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_url_sub_title]" class="layui-input" value="{$info.custom_url_sub_title}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">链 接</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_url]" class="layui-input" value="{$info.custom_url}">
									</div>
									<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[custom_url]')" style="float:left">选择链接</button>
								</div>

								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label">自定义入口二：</label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">名 称</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_cell1_name]" class="layui-input" value="{$info.custom_cell1_name}">
									</div>
								</div>
								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">备 注</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_cell1_tips]" class="layui-input" value="{$info.custom_cell1_tips}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">链 接</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[custom_cell1_url]" class="layui-input" value="{$info.custom_cell1_url}">
									</div>
									<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[custom_cell1_url]')" style="float:left">选择链接</button>
								</div>

								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label">自定义入口三：</label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">名 称</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[promotion_url_name]" class="layui-input" value="{$info.promotion_url_name}">
									</div>
								</div>
								<div class="layui-form-item" style="margin-bottom:3px">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">备 注</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[promotion_url_sub_title]" class="layui-input" value="{$info.promotion_url_sub_title}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"></label>
									<div class="layui-form-mid" style="margin-right:0;background:#e6e6e6;padding: 9px 9px !important">链 接</div>
									<div class="layui-input-inline">
										<input type="text" style="border-radius:0 2px 2px 0" name="info[promotion_url]" class="layui-input" value="{$info.promotion_url}">
									</div>
									<button class="layui-btn layui-btn-primary" onclick="chooseUrl('info[promotion_url]')" style="float:left">选择链接</button>
								</div>

								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>使用提醒：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[notice]" lay-verify="required"  lay-verType="tips" class="layui-input" value="{$info['notice']}">
									</div>
									<div class="layui-form-mid layui-word-aux">16个汉字以内</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>使用说明：</label>
									<div class="layui-input-inline" style="width:400px !important">
										<textarea name="info[description]" lay-verify="required"  lay-verType="tips" class="layui-textarea">{$info.description}</textarea>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>特权说明：</label>
									<div class="layui-input-inline" style="width:400px !important">
										<textarea name="info[prerogative]" lay-verify="required"  lay-verType="tips" class="layui-textarea">{$info.prerogative}</textarea>
									</div>
								</div>
								<div class="layui-form-item bonus_rules" {if !in_array('积分',$info['custom_field'])}style="display:none"{/if}>
									<label class="layui-form-label"><span class="redstar"></span>积分规则：</label>
									<div class="layui-input-inline" style="width:400px !important">
										<input type="text" name="info[bonus_rules]" class="layui-input" value="{$info['bonus_rules']}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar"></span>客服电话：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[service_phone]" class="layui-input" value="{$info['service_phone']}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>发卡数量：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[quantity]" class="layui-input" value="{if $info['quantity']}{$info['quantity']}{else}100000{/if}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>有效期：</label>
									<div class="layui-input-inline">
										<div class="layui-form-item" style="width:500px !important">
											<input type="radio" name="info[date_info_type]" value="DATE_TYPE_PERMANENT" title="永久有效" {if $info['date_info_type']=='DATE_TYPE_PERMANENT'}checked{/if} lay-filter="yxqtype"/>
											<input type="radio" name="info[date_info_type]" value="DATE_TYPE_FIX_TIME_RANGE" title="固定日期" {if $info['date_info_type']=='DATE_TYPE_FIX_TIME_RANGE'}checked{/if} lay-filter="yxqtype"/>
											<input type="radio" name="info[date_info_type]" value="DATE_TYPE_FIX_TERM" title="领取后时长" {if $info['date_info_type']=='DATE_TYPE_FIX_TERM'}checked{/if} lay-filter="yxqtype"/>
										</div>
									</div>
								</div>
								<div class="layui-form-item" id="yxqtimeitem" {if $info['date_info_type']!='DATE_TYPE_FIX_TIME_RANGE'}style="display:none"{/if}>
									<label class="layui-form-label"></label>
									<div class="layui-form-mid">有效期时间</div>
									<div class="layui-input-inline" style="width:150px !important">
										<input type="text" name="info[date_info_begin_time]" value="{$info['date_info_begin_time']}" id="date_info_begin_time" class="layui-input"/>
									</div>
									<div class="layui-form-mid">至</div>
									<div class="layui-input-inline" style="width:150px !important">
										<input type="text" name="info[date_info_end_time]" value="{$info['date_info_end_time']}" id="date_info_end_time" class="layui-input"/>
									</div>
								</div>
								<div class="layui-form-item" id="yxqdateitem" {if $info['date_info_type']!='DATE_TYPE_FIX_TERM'}style="display:none"{/if}>
									<label class="layui-form-label"></label>
									<div class="layui-form-mid">领取后</div>
									<input type="hidden" name="info[date_info_fixed_begin_term]" value="{$info['date_info_fixed_begin_term']|default=0}" class="layui-input"/>
									<div class="layui-input-inline" style="width:70px !important">
										<input type="text" name="info[date_info_fixed_term]" value="{$info.date_info_fixed_term}" class="layui-input"/>
									</div>
									<div class="layui-form-mid">天内有效</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">开卡填写信息：</label>
									<div class="layui-input-inline" style="width:400px !important">
									<table class="layui-table" id="ggtable">
										<thead>
										<tr>
											<th style="width:100px">状态</th>
											<th style="width:200px">字段名称</th>
											<th style="width:100px">是否必填</th>
										</tr>
										</thead>
										<tbody>
											{foreach $info.field_list as $k=>$v}
											<tr>
												<td><input type="checkbox" name="field_list[{$k}][isshow]" value="1" lay-skin="switch" lay-text="开启|关闭" {if $v['isshow']==1}checked{/if}></td>
												{if in_array($k,['name','mobile','idcard','sex','birthday','email','location','education','industry','income','habit'])}
												<td><input type="hidden" name="field_list[{$k}][name]" value="{$v.name}"/>{$v.name}</td>
												{else}
												<td><input type="text" class="layui-input" placeholder="请填写字段名称" name="field_list[{$k}][name]" value="{$v.name}"/></td>
												{/if}
												<td><input type="checkbox" name="field_list[{$k}][required]" value="1" lay-skin="switch" lay-text="是|否" {if $v['required']==1}checked{/if}></td>
											</tr>
											{/foreach}
										</tbody>
									</table>
									</div>
								
								</div>
								<!--<div class="layui-form-item">
									<label class="layui-form-label">二维码：</label>
									<div class="layui-input-inline">
										<img src='{$info['tgpic']}' style="width:100px;height:100px;">
									</div>
									<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:100px">微信扫描二维码领取会员卡</div>
								
								</div>-->
								<!--<div class="layui-form-item">
									<label class="layui-form-label">领取会员卡链接：</label>
									<div class="layui-input-inline">
										<textarea type="text" readonly  class="layui-textarea" style="width:500px">{$info['ret_url']}</textarea>
									</div>
								</div>-->
							</div>
						</div>
						<div class="layui-form-item" style="margin-top:20px">
							<label class="layui-form-label"></label>
							<div class="layui-input-block">
								<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
{include file="public/js"/}
<script src="__STATIC__/admin/js/jscolor.js"></script>
<script language='javascript' src="__STATIC__/admin/poster/designer.js"></script>
<script language='javascript' src="__STATIC__/admin/poster/jquery.contextMenu.js"></script>

<script language='javascript'>
	$(".layui-form input").bind("input change propertychange",function(event){
		console.log('---------')
		console.log($(this).val())
		var value = $(this).val()
		var field = $(this).attr('name');
		field = field.replace('info[','');
		field = field.replace(']','');
		console.log(field)
		
		if(field == 'color'){
			$("[bind-data=bg_type]").css('background',value);
		}
		if(field == 'background_pic_url'){
			$("[bind-data=bg_type]").css('background','url('+value+') no-repeat center');
		}
		
		if(field == 'center_title'){
			if(value == ''){
				$("#center_show").hide();
			}else{
				$("#center_show").show();
			}
		}
		if(field == 'promotion_url_name' || field == 'promotion_url'){
			if($("input[name='info[promotion_url_name]']").val() == '' || $("input[name='info[promotion_url]']").val()==''){
				$("#promotion_url_show").hide();
			}else{
				$("#promotion_url_show").show();
			}
		}
		if(field == 'custom_url_name' || field == 'custom_url'){
			if($("input[name='info[custom_url_name]']").val() == '' || $("input[name='info[custom_url]']").val()==''){
				$("#custom_url_show").hide();
			}else{
				$("#custom_url_show").show();
			}
		}
		if(field == 'custom_cell1_url'){
			if(value == ''){
				$("#custom_cell1_show").hide();
			}else{
				$("#custom_cell1_show").show();
			}
		}
		if(field == 'custom_field_customize1_name' || field == 'custom_field_customize1_value' || field == 'custom_field_customize2_name' || field == 'custom_field_customize2_value'){
			custom_field_preview();
		}

		$("[bind-data="+field+"]").each(function(i,item){
			if($(item).is('img')){
				$(item).attr('src',value);
			}else{
				$(item).text(value);
			}
		})
	});
	layui.form.on('radio(bg_type)',function(data){
		if(data.value==0){
			console.log($("input[name='info[color]']").val())
			$('.bg_type0').show();
			$('.bg_type1').hide();
			$("[bind-data=bg_type]").css('background',$("input[name='info[color]']").val());
		}else{
			$('.bg_type1').show()
			$('.bg_type0').hide()
			$("[bind-data=bg_type]").css('background','url('+$("input[name='info[background_pic_url]']").val()+') no-repeat center');
		}
	})
	layui.form.on('checkbox(custom_field)',function(data){
		var checkedlength = $("[name='info[custom_field][]']:checked").length;
		if(checkedlength > 3){
			$(data.elem).prop('checked',false);
			layui.form.render('checkbox')
			layer.msg('最多选三个');
		}
		if(data.value == '自定义1'){
			if($(data.elem).prop('checked')){
				$('#custom_field_customize1_set').show();
			}else{
				$('#custom_field_customize1_set').hide();
			}
		}
		if(data.value == '自定义2'){
			if($(data.elem).prop('checked')){
				$('#custom_field_customize2_set').show();
			}else{
				$('#custom_field_customize2_set').hide();
			}
		}
		custom_field_preview();
	})
	$("#custom_cell_sortable" ).sortable({stop:function(event,ui){
		custom_field_preview();
	}})

	function selectcolor(color){
		$("input[name='info[color]']").val(color);
		$("input[name='info[color]']").change();
	}
	function custom_field_preview(){
		var html = '';
		var hasbonus = false;
		$("input[name='info[custom_field][]']:checked").each(function(i,item){
			html+='<div class="item">';
			if(item.value == '自定义1'){
				html+='	<span class="t1">'+$("input[name='info[custom_field_customize1_name]").val()+'</span>';
			}else if(item.value == '自定义2'){
				html+='	<span class="t1">'+$("input[name='info[custom_field_customize2_name]").val()+'</span>';
			}else{
				html+='	<span class="t1">'+item.value+'</span>';
			}
			if(item.value=='积分'){
				hasbonus = true
				html+='	<span class="t2">100</span>';
			}else if(item.value=='余额' || item.value=='{:t('余额')}'){
				html+='	<span class="t2">0.00</span>';
			}else if(item.value=='优惠券' || item.value=='{:t('优惠券')}'){
				html+='	<span class="t2">2</span>';
			}else if(item.value=='等级'){
				html+='	<span class="t2">{$defaultlv.name}</span>';
			}else if(item.value=='自定义1'){
				html+='	<span class="t2">'+$("input[name='info[custom_field_customize1_value]").val()+'</span>';
			}else if(item.value=='自定义2'){
				html+='	<span class="t2">'+$("input[name='info[custom_field_customize2_value]").val()+'</span>';
			}else{
				html+='	<span class="t2">查看</span>';
			}
			html+='</div>';
		});
		$('#custom_field_preview').html(html);
		
		if(hasbonus){
			$('.bonus_rules').show();
		}else{
			$('.bonus_rules').hide();
		}
	}
	layui.form.on('radio(yxqtype)',function(data){
		if(data.value=='DATE_TYPE_FIX_TIME_RANGE'){
			$('#yxqtimeitem').show();
			$('#yxqdateitem').hide();
		}else if(data.value == 'DATE_TYPE_FIX_TERM'){
			$('#yxqtimeitem').hide();
			$('#yxqdateitem').show();
		}else{
			$('#yxqtimeitem').hide();
			$('#yxqdateitem').hide();
		}
	});
	layui.laydate.render({ 
		elem: '#yxqtime'
		,type: 'datetime'
		,range: '~',
		trigger: 'click'
	});
	layui.laydate.render({
		elem: '#date_info_begin_time'
		,type: 'datetime'
		,range: false,
		trigger: 'click'
	});
	layui.laydate.render({
		elem: '#date_info_end_time'
		,type: 'datetime'
		,range: false,
		trigger: 'click'
	});
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		if(field['info[logo_url]'] == ''){
			dialog('请上传会员卡logo');
			return;
		}
		//if(field['info[background_pic_url]'] == ''){
		//	dialog('请上传会员卡背景图');
		//	return;
		//}
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			if(data.status == 1){
				dialog(data.msg,data.status);
				if(data.status==1){
					setTimeout(function(){
						parent.layer.closeAll();
						parent.tableIns.reload();
					},1000)
				}
			} else {
				dialog(data.msg);
			}
		})
	})
	//上传图片
	function setpic(hideid,imgid){
		fileUploader.show(function(imgs) {
			var params = '';
			console.log(imgs);
			if (imgs.length == 0) {
				return;
			} else {
				$('#'+imgid).attr('src',imgs.url + params);
				$('#'+hideid).val(imgs.url + params);
				$("#hyk_logo").attr('src',imgs.url + params);
			}
		},{type: 'image',direct: false,multi: false});
	}
	
	function setpic2(hideid,imgid){
		fileUploader.show(function(imgs) {
			var params = '';
			console.log(imgs);
			if (imgs.length == 0) {
				return;
			} else {
				$('#'+imgid).attr('src',imgs.url + params);
				$('#'+hideid).val(imgs.url + params);
				$("#hyk_bg").css('background','url('+imgs.url + params+')');
			}
		},{type: 'image',direct: false,multi: false});
	}
	var nowfield
	function chooseUrl(field){
		nowfield = field
		layer.open({type:2,shadeClose:true,area:['1100px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}"})
	}
	function chooseLink(urlname,url){
		if(url.indexOf('miniProgram::') === 0){
			
		}else{
			url = '{$Think.const.PRE_URL2}/h5/{$aid}.html?#'+url;
		}
		$("input[name='"+nowfield+"']").val(url);
	}
</script>
	{include file="public/copyright"/}
</body>
</html>